const { PrismaClient } = require('@prisma/client');

async function enableChains() {
  const prisma = new PrismaClient();
  
  try {
    console.log('🔧 启用Base和Solana链监控...');
    
    // 启用Base链
    const baseResult = await prisma.chainMonitorConfig.update({
      where: { chain: 'base' },
      data: { isEnabled: true }
    });
    console.log('✅ Base链已启用');
    
    // 启用Solana链
    const solanaResult = await prisma.chainMonitorConfig.update({
      where: { chain: 'solana' },
      data: { isEnabled: true }
    });
    console.log('✅ Solana链已启用');
    
    // 显示所有配置
    console.log('\n📋 更新后的配置:');
    const allConfigs = await prisma.chainMonitorConfig.findMany({
      orderBy: { chain: 'asc' }
    });
    
    allConfigs.forEach(config => {
      console.log(`${config.chain}:`);
      console.log(`  - 启用: ${config.isEnabled}`);
      console.log(`  - RPC: ${config.rpcUrl}`);
      console.log(`  - 最小金额: $${config.minValueUsd}`);
      console.log(`  - 区块时间: ${config.blockTime}ms`);
    });
    
    console.log('\n🎉 链配置更新完成！');
    
  } catch (error) {
    console.error('❌ 更新配置失败:', error);
    process.exit(1);
  } finally {
    await prisma.$disconnect();
  }
}

enableChains(); 